local hx__mybh = fk.CreateSkill {
  name = "hx__mybh",
  tags = {Skill.Compulsory,},
}

hx__mybh:addEffect(fk.DamageInflicted, {
  anim_type = "negative",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(hx__mybh.name)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local max = 1
    for _,p in ipairs(player.room.alive_players) do
      if p:hasSkill("hx__AIDS",true) then
        max = p:getMark("@hx__AIDS_num")
      end
    end
    local x = math.max(1,max)
    local y = data.damage
    data.damage =  y * x
  end,
})

hx__mybh:addEffect(fk.CardUsing, {
  anim_type = "negative",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(hx__mybh.name)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local max
    for _,p in ipairs(player.room.alive_players) do
      if p:hasSkill("hx__AIDS",true) then
        max = p:getMark("@hx__AIDS_num")
      end
    end
    local x = math.max(1,max)
    local ids = player:getCardIds("he")
    if #ids > 0 then
      local n = math.min(#ids, x)
      local to_throw = table.random(ids, n)
      room:throwCard(to_throw, hx__mybh.name, player, player)
    end
  end,
})


return hx__mybh
